package com.neuedu.javase.exceptions;/**
 * @auth 金山老师
 * title:   书籍代码
 * creatime: 2022-09-28 9:03
 * 描述 : 
 */
public class Runner {
    public static void main(String[] args) {

        System.err.println("err ");



        int ages[] = {10,20,30,40};
//        ages.length = 4

        //java.lang.ArrayIndexOutOfBoundsException
        try {
            System.out.println("ages[1] = " + ages[1]);
//            close()
        } catch (Exception exception) {
            exception.printStackTrace(); //打印异常的栈
//            close()
        }finally {
            System.out.println("有没有异常都会走的程序，  关闭资源");
        }


        for (int i = 0; i < 5; i++) {
            System.out.println("ages["+i+"] = " + ages[i]);
        }


    }
}
